<template>
	<view>
		<zmm-watermark :watermark="userStore.watermark" v-if="userStore.watermark"></zmm-watermark>
		<view class="content detail">
			<!--客户地址信息-->
			<view class="detail-item">
				<uni-section title="客户地址信息" type="line"></uni-section>
				<view class="detail-content">
					<view class="detail-text">
						联系人：
						<text>{{info.name}}</text>
					</view>
					<view class="detail-text">
						联系电话：
						<text>{{info.phone}}</text>
						<text class="detail-text-copy" @click="copyText(info.phone)">复制</text>
						<text class="detail-text-copy" @click="call(info.phone)">拨打</text>
					</view>
					<view class="detail-text">
						标签：
						<text>{{info.label}}</text>
					</view>
					<view class="detail-text">
						备注：
						<text>{{info.remark}}</text>
					</view>
					<view class="detail-text">
						区域：
						<text>{{arrText(setStore.allProvinceList, info.regionCode)}}</text>
					</view>
					<view class="detail-text">
						地址：
						<text>{{info.addr}}</text>
					</view>
					<view class="detail-text">
						详细地址：
						<text></text>
					</view>
					<view class="detail-text">
						默认地址：
						<text></text>
					</view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script setup>
import { onLoad } from '@dcloudio/uni-app';
import { computed, onMounted, ref } from 'vue';
import { tab, auth, modal } from "@/plugins"
import { getTitle } from "@/utils/getter"
import { checkPermi, checkRole, checkOnlyPermi, checkOnlyRole } from "@/utils/permission"
import { customerAddrDetail } from "@/api/erp_api/customer"
import { arrText, copyText, previewImg } from '@/utils/ty.js';
import useUserStore from '@/store/modules/user'
import useSetStore from '@/store/modules/set'

	const userStore = useUserStore()
	const setStore = useSetStore()
	onLoad(async (option) => {
		if (option.id) {
			id.value = option.id
			getDetail()
		}
	})
	
	// 数据查询
	const id = ref('')
	const info = ref({})
	const isLoading = ref(false)
	
	const getDetail = () => {
		const params = {
			id: id.value
		}
		isLoading.value = true
		uni.showLoading({
			title: '数据加载中...'
		})
		customerAddrDetail(params).then(res => {
			info.value = res.data || {}
			isLoading.value = false
			uni.hideLoading()
    }).catch(() => {
			isLoading.value = false
			uni.hideLoading()
		})
	}
	
	// 拨打电话
	const call = (phone) => {
		uni.makePhoneCall({
			phoneNumber: phone
		})
	}
	
</script>

<style scoped lang="scss">
</style>
